package com.twu.biblioteca;

import com.twu.biblioteca.model.User;

import java.util.Collection;
import java.util.LinkedList;
import java.util.Optional;

/**
 * Created by sgreweni on 31.07.14.
 */
public class UserManager {
    private final Collection<User> users = new LinkedList<>();

    public Optional<User> authenticateUser(String libraryNumber, String password){
        return users.stream().filter(user -> user.getLibraryNumber().equals(libraryNumber) && user.getPassword().equals(password)).findFirst();
    }

    public void addUser(User user){
        users.add(user);
    }

}
